package com.cloudkinto.controller.covershows;

import com.cloudkinto.service.covershows.ThymeleafShowCustomerService;
import com.cloudkinto.service.covershows.vo.CustomerCasePageRes;
import com.cloudkinto.service.covershows.vo.NewsInformationReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author fanp
 * @version v1.0.0
 * @Description :
 * @Create on : 2021/3/25 13:57
 **/
@Controller
@RequestMapping("/customer")
public class ThymeleafShowCustomerController {
    @Autowired
    private ThymeleafShowCustomerService service;
    @RequestMapping("/showCompanyCase/{id}")
    public String showNewsInformationDetail(Model model, @PathVariable("id") Integer id) {
        NewsInformationReq newsInformationReq = service.selectDetail(id);
        model.addAttribute("newsInformationReq", newsInformationReq);
        return "newsDetail";
    }
    @RequestMapping("/showCompanyCase/{current}/{pageSize}")
    public String showCompanyCase(Model model, @PathVariable(required = false, value = "current") String current,
                                  @PathVariable(value = "pageSize") String pageSize) {
        Map<String, String> map = new HashMap<>();
        map.put("current", current);
        map.put("pageSize", pageSize);
        List<CustomerCasePageRes> customerCasePageRes = service.getPageList(map);
        model.addAttribute("dataMap",customerCasePageRes);
        return "companyCase";
    }
}
